home *** CD-ROM | disk | FTP | other *** search
/ Aminet 25 / Aminet 25 (1998)(GTI - Schatztruhe)[!][Jun 1998].iso / Aminet / dev / c / MemPools.lha / calloc.c next >
C/C++ Source or Header  |  1998-03-12  |  2KB  |  74 lines

  1. /**
  2. ***  MemPools:  malloc() replacement using standard Amiga pool functions.
  3. ***  Copyright  (C)  1994    Jochen Wiedmann
  4. ***    changes       1998    Matthias Andree
  5. ***
  6. ***  This program is free software; you can redistribute it and/or modify
  7. ***  it under the terms of the GNU General Public License as published by
  8. ***  the Free Software Foundation; either version 2 of the License, or
  9. ***  (at your option) any later version.
  10. ***
  11. ***  This program is distributed in the hope that it will be useful,
  12. ***  but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. ***  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. ***  GNU General Public License for more details.
  15. ***
  16. ***  You should have received a copy of the GNU General Public License
  17. ***  along with this program; if not, write to the Free Software
  18. ***  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19. ***
  20. ***
  21. ***  This file contains the calloc() replacement.
  22. ***
  23. ***
  24. ***  Computer:  Amiga 4000
  25. ***
  26. ***  Compilers: gcc 2.7.2
  27. ***             SAS/C 6.58
  28. ***
  29. ***
  30. ***  Author:    Jochen Wiedmann
  31. ***             Am Eisteich 9
  32. ***       72555 Metzingen
  33. ***             Germany
  34. ***
  35. ***             Phone: (0049) 7123 14881
  36. ***             Internet: jochen.wiedmann@uni-tuebingen.de
  37. ***
  38. ***  Bugfixes
  39. ***  Updates:   Matthias Andree
  40. ***             Stormstr. 14
  41. ***             58099 Hagen
  42. ***             Germany
  43. ***
  44. ***             Phone: +49-(0)23 31-96 30 72
  45. ***
  46. ***             E-Mail: mandree@dosis.uni-dortmund.de
  47. ***
  48. **/
  49.  
  50.  
  51.  
  52.  
  53. /*
  54.     Include files and compiler specific stuff
  55. */
  56. #include <stdlib.h>
  57. #include <string.h>
  58.  
  59.  
  60.  
  61. void *calloc(size_t size, size_t numobjs)
  62.  
  63. {
  64.     void *ptr;
  65.  
  66.     if ((size *= numobjs)) {
  67.     if ((ptr = malloc(size))) {
  68.         memset(ptr, '\0', size);
  69.         return(ptr);
  70.     }
  71.     }
  72.     return(NULL);
  73. }
  74.